/*
Simple Forum Auto Poster.
Copyright (C) 2011 Gianni Van Hoecke.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package domain.plugin.base;

import domain.forumdata.Forum;
import persistence.net.Client;

/**
 *
 * @author Gianni Van Hoecke <gianni.vh@gmail.com>
 *
 * Interface for the interaction between the program and the plugin.
 */
public interface Interaction
{
    /**
     * Notifies the program to ask a YES/NO question to the user.
     * @param question The question.
     * @param title The title of the question.
     * @return True if the user answered YES, false otherwise.
     */
    public boolean askYesNoQuestion(String question, String title);

    /**
     * Notifies the program to asks input from the user.
     * @param text The text to show to the user.
     * @param title The title of the box.
     * @return The input.
     */
    public String askForInput(String message, String title);

    /**
     * Notifies the program to asks a password input from the user.
     * @param text The text to show to the user.
     * @param title The title of the box.
     * @return The char array.
     */
    public char[] askPassword(String text, String title);
    
    /**
     * Notifies the program to show a message to the user.
     * @param message The message to show.
     * @param title The title for the message.
     */
    public void showInformationMessage(String message, String title);

    /**
     * Notifies the program to set the enabled state of the UI.
     * @param enabled True when the UI should be enabled, false otherwise.
     */
    public void setButtonsEnabled(boolean enabled);

    /**
     * Notifies the program to update the progress of a certain pending action.
     * @param progress The percentage of completion of the pending action.
     * @param status The status to show.
     */
    public void updateProcess(int progress, String status);

    /**
     * Notifies the program to set the status as indeterminate or not.
     * @param value True for indeterminate, false otherwise.
     * @param status The text to display.
     */
    public void setStatusIndeterminate(boolean value, String status);

    /**
     * Notifies the program to insert text in the post body.
     * The text will be entered at the cursor position.
     * @param text
     */
    public void insertInPostBody(String text);

    /**
     * Notifies the program to return the selected text in the post body.
     * @return The selected text. This can be null.
     */
    public String getSelectedTextInPostBody();

    /**
     * Notifies the program to add a link.
     * @param link The link to add.
     */
    public void addForumTopicLink(String link);

    /**
     * Notifies the program to add a new error to the list with an unique ID.
     * @param forum The forum object.
     * @param loginOK Whether the login was successful or not.
     * @param postOK Whether the post was successful or not.
     * @param error The returned HTML error page.
     */
    public void addError(Forum forum, boolean loginOK, boolean postOK, String error);

    /**
     * Initiates a new Client object.
     * If the user has proxies set, a client with a random proxy will be used.
     * @return The client object.
     */
    public Client getRandomClient();
}